<html>
<head>
	<title>testXML</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<script type="text/javascript" src="../scripts/coos.js"></script>
	<script type="text/javascript" src="../scripts/coos.ext.xml.js"></script>
	<style type="text/css">
	html,body{font-size:14px;color:#333333; margin:0px;padding:0px; line-height:120%; overflow:hidden;}
	</style>

	<script type="text/javascript">
	
	function testXML()
	{
		//测试,示例代码
		var xmlstr = "<response sessionID='48C14D02578E9D28D3E897671378E331' status='ok'><aa id='a1' cc='dd'></aa><aa id='a2' cc='ee'></aa><bb id='b1'></bb><title>111</title><title>222</title><title></title><title>444</title></response>";
		var xml = coos.xml.parse(xmlstr);
		
		var root = coos.xml.root(xml);
		//根节点的属性不能使用coos.xml.attribute.values获得
		//alert(coos.xml.attribute.value(root,"sessionID"));//48C14D02578E9D28D3E897671378E331
		
		var aa = coos.xml.node(xml,"aa");
		//alert(coos.xml.attribute.value(aa,"cc"));//dd
		//alert(coos.xml.nodes(xml,"aa").length);//2
		
		var nodes = coos.xml.childNodes(xml);
		//alert(nodes.length);//7
		
		//alert(coos.xml.node.value(xml,"title"));//111
		
		//alert(coos.xml.node.values(xml,"title"));//111,222,,444
		//alert(coos.xml.attribute.values(xml,"aa","id"));//a1,a2
		//alert(coos.xml.attribute.values(root,"aa","id"));//a1,a2
		//alert(coos.xml.attribute.values(nodes,"aa","id"));//a1,a2
		
		//动态创建并解析xml
		var xml2 = coos.xml.create('<xml id="xx"><book><title>creat xml test</title></book></xml>');
		var book = coos.xml.node(xml2,"book");
		alert(coos.xml.node.value(book,"title"));//creat xml test
	}
	
	</script>
</head>
<body onload="testXML()">
<center>
<div onclick="testXML()" style="margin:20px;text-align:center;font-size:18px;color:#FF0000;cursor:pointer;">
	test xml onclick here!
	<br /><br />
	请自行修改testXML方法验证
</div>
</center>
</body>
</html>